package LBS;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class library {//201621123021
 private static final String URL="jdbc:mysql://localhost:3306/library";
 private static final String NAME="root";
 private static final String PASSWORD="123456";
 private static Connection con=null;
 public  void select() throws Exception {//查看书籍单
  try {
   Class.forName("com.mysql.jdbc.Driver");
   Connection con = DriverManager.getConnection(URL, NAME, PASSWORD);
   Statement sta = con.createStatement();
   ResultSet rs = sta.executeQuery("select * from book");
   while (rs.next()) {
    System.out.println(rs.getString("subject") + "|" + rs.getString("title") + "|" + rs.getString("keyword"));
   }
  } catch (Exception e) {
   e.printStackTrace();
  }


 }

}
